<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>网咖转帐</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
    <meta content="telephone=no" name="format-detection"/>
    <link href="{{url('css/main.css')}}" type="text/css" rel="stylesheet"/>
    <script src="{{url('js/jquery.js')}}" type="text/javascript"></script>
</head>

<body>
<div class="transfer_box_top">
    <h1 class="transfer_list_title">截至 <span class="transfer_list_time">{{date('Y-m-d H:i:s',time())}}</span> 您的账单如下：</h1>

    @foreach ($mybar as $info)
        <p>{{$info->shopName}} 余额为：<span class="spare_user">￥{{$info->amount/100}}</span></p>
    @endforeach


</div>
<div style=" width:100%; height:8px; background-color:#efefef;  border-top:solid 1px #e3e3e5; border-bottom:solid 1px #e3e3e5;"></div>

<p class="sel_title">请选择转出网咖：</p>

<div style="padding-left:10px; padding-right:10px; padding-bottom:10px;">
    <select name="sourceid" id="sourceid" class="sel_bar">
        @foreach ($mybar as $info)
            <option value="{{$info->shopId}}">{{$info->shopName}}</option>
        @endforeach
    </select>
</div>

</div>

<p class="sel_title">请选择转入网咖：</p>

<div style="padding-left:10px; padding-right:10px; padding-bottom:10px;">
    <select name="descid" id="descid" class="sel_bar">
        <option value=""></option>
        @foreach ($allBars as $allBar)
            <option value="{{$allBar->shopId}}">{{$allBar->shopName}}</option>
        @endforeach
    </select>
</div>
</div>

<p class="sel_title">请输入转出金额：</p>

<div style="padding-left:10px; padding-right:10px; padding-bottom:10px;">
    <div class="box_input_money">
        <div class="box_img_money"><img src="{{url('images/transfer_ico_input.png')}}" width="40"></div>
        <input name="amount" class="input_money" type="number">
    </div>
</div>


<div style="padding:10px;"><button class="input_complete" type="submit">确认转帐</button></div>

<script>
    $(function(){
        $('.input_complete').click(function(){
            $(".input_complete").attr("disabled","disabled");
            $(".input_complete").css("background","#e9e9e9");
            var sourceid=$('#sourceid').val();
            var descid=$("#descid").val();
            var amount=$('.input_money').val();
            if(sourceid==''||descid==''||sourceid==descid){
                alert('请选择转入网吧!');
                $(".input_complete").removeAttr("disabled","disabled");
                return false;
            }
            $.post("/wx/dotransfer",{sourceid:sourceid,descid:descid,amount:amount},function(result){
                console.log(result);
                if(result.ret==0){
                    alert('转账成功');
                    window.location.reload();
                }else{
                    alert(result.message);
                    window.location.reload();
                }
            },"json")
        })
    })
</script>
</body>

</html>
